/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * generarCotizacionExterna.java
 *
 * Created on 30-jun-2011, 9:35:41
 */

package vista.cotizacion;

import controlador.reportes.GestorReportesCotizacion;

/**
 *
 * @author Administrador
 */
public class GenerarCotizacion extends javax.swing.JInternalFrame {
    private int cotizacionId;
    /** Creates new form generarCotizacionExterna */
    public GenerarCotizacion(int cotizacionId) 
    {
        initComponents();
        this.cotizacionId = cotizacionId;
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        btnCotizacionSinDetalle = new javax.swing.JButton();
        btnCotizacionExternoSubObras = new javax.swing.JButton();
        btnCotizacionExternoRecursos = new javax.swing.JButton();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jPanel2 = new javax.swing.JPanel();
        jButton4 = new javax.swing.JButton();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        btnCerrar = new javax.swing.JButton();

        setClosable(true);
        setTitle("Generar Cotización");

        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Cotizaciones de uso Externo ( Entregar al Cliente )"));

        btnCotizacionSinDetalle.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/iconos/plantillas/empty.png"))); // NOI18N
        btnCotizacionSinDetalle.setText("Sin Detalle");
        btnCotizacionSinDetalle.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        btnCotizacionSinDetalle.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCotizacionSinDetalleActionPerformed(evt);
            }
        });

        btnCotizacionExternoSubObras.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/iconos/plantillas/x-dia-diagram.png"))); // NOI18N
        btnCotizacionExternoSubObras.setText("Discriminado por Sub-Obras");
        btnCotizacionExternoSubObras.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        btnCotizacionExternoSubObras.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCotizacionExternoSubObrasActionPerformed(evt);
            }
        });

        btnCotizacionExternoRecursos.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/iconos/plantillas/exec.png"))); // NOI18N
        btnCotizacionExternoRecursos.setText("Discriminado por Recursos");
        btnCotizacionExternoRecursos.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        btnCotizacionExternoRecursos.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCotizacionExternoRecursosActionPerformed(evt);
            }
        });

        jLabel3.setText("<HTML>Estos informes pretenden emitir una cotización para el <b>cliente</b> con distintos niveles de detalle según lo que");

        jLabel4.setText("deseen o soliciten.");

        jLabel5.setText("<HTML><b>Sin Detalle</b>: <i>Muestra solo la descripción de la obra y el monto final.</i> ");

        jLabel6.setText("<HTML><b>Discriminado por Sub-Obras:</b><i> La cotización está dividida en las distintas subobras que se realizarán</i> ");

        jLabel7.setText("<HTML><b>Discriminado por Recursos:</b><i> La cotización está discriminada por los tipos de recursos a utilizar</i> ");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, 532, Short.MAX_VALUE)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel7)
                                    .addComponent(jLabel6)
                                    .addComponent(jLabel5)
                                    .addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                .addContainerGap())))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(btnCotizacionSinDetalle, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnCotizacionExternoSubObras)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnCotizacionExternoRecursos, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addContainerGap())))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(1, 1, 1)
                .addComponent(jLabel4)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnCotizacionSinDetalle)
                    .addComponent(btnCotizacionExternoSubObras)
                    .addComponent(btnCotizacionExternoRecursos)))
        );

        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Cotización de uso Interno ( Uso de la Empresa )"));

        jButton4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/iconos/plantillas/exec.png"))); // NOI18N
        jButton4.setText("Resumen completo de la cotización");
        jButton4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton4ActionPerformed(evt);
            }
        });

        jLabel8.setText("<HTML>El objetivo es emitir un <b>resumen completo</b> de la cotización realizada, para que la <b>empresa</b> pueda tener");

        jLabel9.setText("a mano y utilizar.");

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel8)
                    .addComponent(jLabel9, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jButton4, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 522, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel9)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        btnCerrar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/iconos/var/16x16/block.png"))); // NOI18N
        btnCerrar.setText("Cerrar");
        btnCerrar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCerrarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                        .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addComponent(btnCerrar, javax.swing.GroupLayout.Alignment.TRAILING))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(btnCerrar)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

private void btnCerrarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCerrarActionPerformed
    hideLoading();
    this.dispose();
}//GEN-LAST:event_btnCerrarActionPerformed

private void btnCotizacionSinDetalleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCotizacionSinDetalleActionPerformed
    showLoading();
    btnCotizacionSinDetalle.setEnabled(false);

    // Acá tu código ...
    if(cotizacionId>0)
    {
       GestorReportesCotizacion gestor = new GestorReportesCotizacion();
       gestor.emitirCotizacionExternaGeneral(cotizacionId);
    }
    // ...
    hideLoading();
    btnCotizacionSinDetalle.setEnabled(true);
}//GEN-LAST:event_btnCotizacionSinDetalleActionPerformed

private void btnCotizacionExternoSubObrasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCotizacionExternoSubObrasActionPerformed
    showLoading();
    // Acá tu código ...
    if(cotizacionId>0) 
    { 
       GestorReportesCotizacion gestor = new GestorReportesCotizacion();
       gestor.emitirCotizacionExternaSubObras(cotizacionId);
    }
    // ...
    hideLoading();
}//GEN-LAST:event_btnCotizacionExternoSubObrasActionPerformed

private void btnCotizacionExternoRecursosActionPerformed(java.awt.event.ActionEvent evt) {                                                              
    showLoading();
    btnCotizacionSinDetalle.setEnabled(false);

    // Acá tu código ...
    if(cotizacionId>0)
    {
       GestorReportesCotizacion gestor = new GestorReportesCotizacion();
       gestor.emitirCotizacionExternaXRecurso(cotizacionId);
    }
    // ...
    hideLoading();
    btnCotizacionSinDetalle.setEnabled(true);
}                                                             

private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
    
    showLoading();
    jButton4.setEnabled(false);

    // Acá tu código ...
    if(cotizacionId>0) 
    { 
       GestorReportesCotizacion gestor = new GestorReportesCotizacion();
       gestor.emitirCotizacionInterna(cotizacionId);
    }
    // ...
    hideLoading();
    jButton4.setEnabled(true);
}//GEN-LAST:event_jButton4ActionPerformed


private void showLoading()
{
    
}

private void hideLoading()
{

}


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnCerrar;
    private javax.swing.JButton btnCotizacionExternoRecursos;
    private javax.swing.JButton btnCotizacionExternoSubObras;
    private javax.swing.JButton btnCotizacionSinDetalle;
    private javax.swing.JButton jButton4;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    // End of variables declaration//GEN-END:variables

}
